package com.huizhan.web;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.*;
import org.springframework.web.servlet.config.annotation.*;

@SpringBootApplication
public class DemoApplication  extends SpringBootServletInitializer implements WebMvcConfigurer{

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
    }
    
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder){
        return builder.sources(DemoApplication.class);
    }


    @Bean    
    public WebMvcConfigurer webMvcConfigurer() {    
        return new WebMvcConfigurer() {            
            @Override          
            public void addCorsMappings(CorsRegistry registry) {       
                    registry.addMapping("/**").allowedOrigins("*");        
                }       
        };
    }
    
}
